package nowCoder;

public class NumberOf1 {
	public int NumberOf1(int n) {
		int countOf1=0;
		while(n!=0){
			int firstBit = n & 1;
			if(firstBit==1)
				countOf1++;
			n>>>=1;
		}
		return countOf1;
	}
	
	public static void main(String[] args){
		NumberOf1 numberOf1= new NumberOf1();
		System.out.println(numberOf1.NumberOf1(6));
	}
}
